-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable the MaxListenersExceededWarning
in Node when creating event targets for internal use
#3661
Conversation
… targets for internal use
🦋 Changeset detectedLatest commit: e03b47f The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of this? It's pretty heavy handed, but probably correct given how we use event targets internally to implement publish/subscribe/demux.
BundleMonFiles added (2)
Files updated (17)
Unchanged files (108)
Total files change +1.44KB +0.43% Final result: ✅ View report in BundleMon website ➡️ |
A preview of the GitHub Pages site based on this PR is now available here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I didn't know Node would start throwing warning at 10 listeners haha. Thanks for the fix!
export const AbortController = class extends globalThis.AbortController { | ||
constructor(...args: ConstructorParameters<typeof globalThis.AbortController>) { | ||
super(...args); | ||
setMaxListeners(Number.MAX_SAFE_INTEGER, this.signal); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason behind setting this inside the AbortController
constructor as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signal
is an EventTarget
, and apparently attaching addEventListener('abort', ...)
to it more than 10 times also raises this warning.
Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up. |
Summary
Read all about why, here: https://solana.stackexchange.com/a/17971/75
Fixes #3624.
Test Plan
No more warning.